#include "Logic/MBClusterInstancedBatchProxy.h"

FMBClusterInstancedBatchProxy::FMBClusterInstancedBatchProxy()
{
	
}

void FMBClusterInstancedBatchProxy::ApplyCustomData(TArray<float>& PerInstanceSMCustomData)
{
	for(const FMBInstanceBatchCharacterRenderInfo& UnitInfo : UnitInfoArray)
	{
		PerInstanceSMCustomData.Add(UnitInfo.MaxBound);
		PerInstanceSMCustomData.Add(UnitInfo.InAnimationFrameMaxIndex);
		PerInstanceSMCustomData.Add(UnitInfo.InAnimationOffset);
		PerInstanceSMCustomData.Add(UnitInfo.InAnimationSpeed);
		PerInstanceSMCustomData.Add(UnitInfo.InAnimationTimeStart);
		PerInstanceSMCustomData.Add(UnitInfo.OutAnimationFrameMaxIndex);
		PerInstanceSMCustomData.Add(UnitInfo.OutAnimationOffset);
		PerInstanceSMCustomData.Add(UnitInfo.OutAnimationSpeed);
		PerInstanceSMCustomData.Add(UnitInfo.OutAnimationTimeStart);
		PerInstanceSMCustomData.Add(UnitInfo.TransitionTime);
		PerInstanceSMCustomData.Add(UnitInfo.TransitionDuration);
		PerInstanceSMCustomData.Add(UnitInfo.CampColor.R);
        PerInstanceSMCustomData.Add(UnitInfo.CampColor.G);
        PerInstanceSMCustomData.Add(UnitInfo.CampColor.B);
	}
}

void FMBClusterInstancedBatchProxy::ApplyTransform(TArray<FTransform>& PerInstanceSMData)
{
	for(const FMBInstanceBatchCharacterRenderInfo& UnitInfo : UnitInfoArray)
	{
		PerInstanceSMData.Add(UnitInfo.Transform);
	}
}

int FMBClusterInstancedBatchProxy::NumCustomDataFloats()
{
	return 14;
}

void FMBClusterInstancedBatchProxy::Empty()
{
	UnitInfoArray.Empty(UnitInfoArray.Max());
}